/*
 * @Author: yanjikun
 * @Date: 2022-05-16 11:03:52
 * @LastEditors: yanjikun
 * @LastEditTime: 2022-05-16 17:14:34
 * @Description: file content
 */

import { FormConfig } from '@/components/Form/src/types/form'
import { TableColumn } from '@/components/Table/src/types/column'
import { TreeSelect } from 'ant-design-vue'
/**搜索表单配置项 */
export const searchRoleConfig: FormConfig[] = []
/**表格配置项 */
export const tableColumns: TableColumn<API.RoleListItem>[] = [
  {
    title: '角色名称',
    dataIndex: 'name',
    key: 'name',
  },
  {
    title: '备注',
    dataIndex: 'description',
    key: 'description',
  },
]
/**数据表单配置项 */
export const dataFormConfig: FormConfig<API.RoleCreateParams>[] = [
  {
    label: '角色名称',
    field: 'name',
    component: 'Input',
    componentProps: {
      placeholder: '请填写角色名称',
    },
    message: '请填写角色名称',
    required: true,
  },
  {
    label: '菜单权限',
    field: 'rights',
    component: 'TreeSelect',
    componentProps: {
      fieldNames: { children: 'children', label: 'name', key: 'id', value: 'id' },
      placeholder: '请选择菜单权限',
      showSearch: true,
      treeNodeFilterProp: 'name',
      treeDefaultExpandAll: true,
      multiple: true,
      maxTagCount: 2,
      treeCheckable: true,
      showCheckedStrategy: TreeSelect.SHOW_ALL,
    },
    message: '请选择菜单权限',
    required: true,
  },
  {
    label: '备注',
    field: 'description',
    component: 'InputTextArea',
    componentProps: {
      placeholder: '请填写备注',
      autoSize: true,
    },
  },
]
